This function will return true or false depending on whether the given gamepad button is detected as being held down or not.
gamepad_button_check(device, button);
| Argument | Description |
|---|---|
| device | Which gamepad device "slot" to check. |
| button | Which gamepad button constant to check for. |
Boolean
if gamepad_button_check(0, gp_face1)
{
if canshoot = true
{
audio_play_sound(snd_Shoot, 0,
false);
instance_create_layer(x, y,
"Bullets", obj_Bullet)
canshoot = false;
alarm[0] = room_speed / 2;
}
}
The above code will detect whether the bottom button of the top face (the "X" on a ps3 controller) is being held down and if so, it will shoot a "bullet" instance and set an alarm.